package Day07_26;

import java.util.Arrays;

public class Test_Array01 {
    public static void main(String[] args) {
        int[] a = {1,12,34,65,3,2};
        Arrays.sort(a);
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]+" ");
        }
        //冒泡排序
//        for (int i = 0; i < a.length-1; i++) {
//            for (int j = a.length-1-i ; j >0 ; j--) {
//                  内层循环不好写了哎哎哎哎哎！！！！
//            }
//        }
        System.out.println("----------------------------");
        for (int i = a.length-1; i >0 ; i--) {
            for (int j = 0; j <i ; j++) {
                if(a[j]>a[j+1]){
                    int t;
                    t=a[j];
                    a[j]=a[j+1];
                    a[j+1]=a[t];
                }
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]+" ");
        }


    }
}
